package com.yy.config;

import net.bytebuddy.asm.Advice;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docket(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2);
        docket.apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.yy.controller")).build();
        return docket;
    }

    private ApiInfo apiInfo(){
        Contact contact = new Contact("yang1yu","http://yang1yu.site","863386791@qq.com");
        return new ApiInfo(
               "发票管理",
               "上传pdf文件，自动识别发票",
               "v1",
               "com.org",
               contact,
               "Apache 2.0 许可",
               "....",
                new ArrayList<>()
       );
    }
}
